﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _1_8 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        using (DataClassesDataContext mydata = new DataClassesDataContext())
        {
            var rd1 = from a in mydata.a01108_1
                      where a.qiyeid == Convert.ToInt32(Session["qiyeid"])
                      where a.DATA_MONTH == Convert.ToString(Session["ShenBaoNianDu"])
                      select a;
            foreach (var r in rd1)
            {
                PFK.Text = r.GASOUTPUT_NUMBER == null ? "" : Convert.ToString(r.GASOUTPUT_NUMBER);
                PFKGY.Text = r.GASOUT_NUM == null ? "" : Convert.ToString(r.GASOUT_NUM);
                PFKRS.Text = r.GASCOAL_NUM == null ? "" : Convert.ToString(r.GASCOAL_NUM);
                PFL.Text = r.GAS_CNT == null ? "" : string.Format("{0:#.####}", r.GAS_CNT);
                PFLGY.Text = r.TEC_OUTCNT == null ? "" : string.Format("{0:#.####}", r.TEC_OUTCNT);
                PFLRS.Text = r.FIRE_OUTCNT == null ? "" : string.Format("{0:#.####}", r.FIRE_OUTCNT);

            }

            Label[] lbQHJ = new Label[] { this.QHJ1, this.QHJ2, this.QHJ3, this.QHJ4, this.QHJ5, this.QHJ5 };
            Label[] lbXZQCL = new Label[] { this.XZQCL1, this.XZQCL2, this.XZQCL3, this.XZQCL4, this.XZQCL5, this.XZQCL5 };
            Label[] lbRFQCL = new Label[] { this.RFQCL1, this.RFQCL2, this.RFQCL3, this.RFQCL4, this.RFQCL5, this.RFQCL5 };
            Label[] lbGFQCL = new Label[] { this.GFQCL1, this.GFQCL2, this.GFQCL3, this.GFQCL4, this.GFQCL5, this.GFQCL5 };
            Label[] lbPHJ = new Label[] { this.PHJ1, this.PHJ2, this.PHJ3, this.PHJ4, this.PHJ5, this.PHJ5 };
            Label[] lbPDB = new Label[] { this.PDB1, this.PDB2, this.PDB3, this.PDB4, this.PDB5, this.PDB5 };
            Label[] lbPCB = new Label[] { this.PCB1, this.PCB2, this.PCB3, this.PCB4, this.PCB5, this.PCB5 };
            Label[] lbRHJ = new Label[] { this.RHJ1, this.RHJ2, this.RHJ3, this.RHJ4, this.RHJ5, this.RHJ5 };
            Label[] lbRDB = new Label[] { this.RDB1, this.RDB2, this.RDB3, this.RDB4, this.RDB5, this.RDB5 };
            Label[] lbRCB = new Label[] { this.RCB1, this.RCB2, this.RCB3, this.RCB4, this.RCB5, this.RCB5 };
            Label[] lbGHJ = new Label[] { this.GHJ1, this.GHJ2, this.GHJ3, this.GHJ4, this.GHJ5, this.GHJ5 };
            Label[] lbGDB = new Label[] { this.GDB1, this.GDB2, this.GDB3, this.GDB4, this.GDB5, this.GDB5 };
            Label[] lbGCB = new Label[] { this.GCB1, this.GCB2, this.GCB3, this.GCB4, this.GCB5, this.GCB5 };

            var rd2 = from a in mydata.a01108_2
                      join c in mydata.CODE_POLLUTION_TABLE on a.CODE equals c.CODE
                      where a.qiyeid == Convert.ToInt32(Session["qiyeid"])
                      where a.DATA_MONTH == Convert.ToString(Session["ShenBaoNianDu"])
                      select new
                      {
                          c.NAME,
                          a.SRKXH,
                          a.DEAL_COUNT,
                          a.NEW_NUM,
                          a.COAL_CLEANCNT,
                          a.TEC_CLEANCNT,
                          a.YEAR_SUMCOUNT,
                          a.REACH_COUNT,
                          a.OVER_COUNT,
                          a.FIRE_SUMCNT,
                          a.FIRE_REACHCNT,
                          a.FIRE_OVERCNT,
                          a.TEC_SUMCNT,
                          a.TEC_REACHCNT,
                          a.TEC_OVERCNT
                      };

            int i = 0;
            foreach (var r in rd2)
            {
                i = (int)r.SRKXH - 1;
                if (i >= 5)
                {
                    WRW.Text = r.NAME;
                }
                lbQHJ[i].Text = r.DEAL_COUNT == null ? "" : string.Format("{0:#.####}", r.DEAL_COUNT);
                lbXZQCL[i].Text = r.NEW_NUM == null ? "" : string.Format("{0:#.####}", r.NEW_NUM);
                lbRFQCL[i].Text = r.COAL_CLEANCNT == null ? "" : string.Format("{0:#.####}", r.COAL_CLEANCNT);
                lbGFQCL[i].Text = r.TEC_CLEANCNT== null ? "" : string.Format("{0:#.####}", r.TEC_CLEANCNT);
                lbPHJ[i].Text = r.YEAR_SUMCOUNT == null ? "" : string.Format("{0:#.####}", r.YEAR_SUMCOUNT);
                lbPDB[i].Text = r.REACH_COUNT == null ? "" : string.Format("{0:#.####}", r.REACH_COUNT);
                lbPCB[i].Text = r.OVER_COUNT == null ? "" : string.Format("{0:#.####}", r.OVER_COUNT);
                lbRHJ[i].Text = r.FIRE_SUMCNT == null ? "" : string.Format("{0:#.####}", r.FIRE_SUMCNT);
                lbRDB[i].Text = r.FIRE_REACHCNT == null ? "" : string.Format("{0:#.####}", r.FIRE_REACHCNT);
                lbRCB[i].Text = r.FIRE_OVERCNT == null ? "" : string.Format("{0:#.####}", r.FIRE_OVERCNT);
                lbGHJ[i].Text = r.TEC_SUMCNT == null ? "" : string.Format("{0:#.####}", r.TEC_REACHCNT);
                lbGDB[i].Text = r.TEC_REACHCNT == null ? "" : string.Format("{0:#.####}", r.TEC_REACHCNT);
                lbGCB[i].Text = r.TEC_OVERCNT == null ? "" : string.Format("{0:#.####}", r.TEC_OVERCNT);
            }

        }
    }
}